home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Plug-In Power Pack for Netscape Communicator
/
Plug-In Power Pack for Netscape Communicator.iso
/
plugins
/
dataviews
/
src
/
tooldebug
/
vudebug.c
< prev
Wrap
C/C++ Source or Header
|
1997-05-08
|
8KB
|
319 lines
#ifndef lint
static char SccsId[]= "@(#)VUdebug.c V1.10 3/13/95";
#endif
/*
| file name - VUdebug.c
|=======================================================================
|
| copyright (C) 1987, V.I. Corporation
|
| VUdebug -- Print datas tructure utilities for VP/VG layer
|
| alan c morse 28 may 87 extracted from VU*print routines
|
|=======================================================================
|
| Function Name Description
| ------------- ------------------------------------------
| VUdbgCcf Print the current state of the context flags
| VUdbgColor Print contents of COLOR_SPEC structure
| VUdbgCtt Print the color threshold table
| VUdbgDgp Print the contents of datagroup
| VUdbgVdp Print the contents of variable descriptor
|
|=======================================================================
*/
#include "std.h"
#include "dvstd.h"
#include "VUfundecl.h"
#include "VGfundecl.h"
BOOLPARAM VIdgvalid V_P_((ADDRESS dgp, char *fcn_name));
BOOLPARAM VIvdvalid V_P_((ADDRESS vdp, char *fcn_name));
char *MGdfname V_P_((ADDRESS fmtraddr));
/*======================================================================
|
| VUdbgCcf
| Prints out context control flag data structure.
*/
void
VUdbgCcf (dgp)
ADDRESS dgp;
{
CHAR *label;
CHAR *yesp = "YES";
CHAR *nop = "NO";
LONG flags;
if (!VIdgvalid (dgp, "VUdbgCcf"))
return;
flags = VGdgcontext (dgp, V_F_ALL);
if (flags & V_FPRE_ERASE)
label = yesp;
else
label = nop;
(VOID) S_PRINTF ("pre erase: %s\t", label);
if (flags & V_FCONTEXT)
label = yesp;
else
label = nop;
(VOID) S_PRINTF ("context: %s\t", label);
if (flags & V_FLEGEND)
label = yesp;
else
label = nop;
(VOID) S_PRINTF ("legend: %s\t", label);
if (flags & V_FVPBOX)
label = yesp;
else
label = nop;
(VOID) S_PRINTF ("vp box: %s\n", label);
(VOID) S_PRINTF ("Axes with ticks: ");
if (flags & V_FT_TICS)
{
(VOID) S_PRINTF ("time ");
if (flags & V_FT_LABEL_TICS)
(VOID) S_PRINTF ("labeled ");
if (flags & V_FT_GRID)
(VOID) S_PRINTF ("gridded ");
(VOID) S_PUTCHAR ('\t');
}
if (flags & V_FD1_TICS)
{
(VOID) S_PRINTF ("d1 ");
if (flags & V_FD1_LABEL_TICS)
(VOID) S_PRINTF ("labeled");
(VOID) S_PUTCHAR ('\t');
}
if (flags & V_FD2_TICS)
{
(VOID) S_PRINTF ("d2 ");
if (flags & V_FD2_LABEL_TICS)
(VOID) S_PRINTF ("labeled");
(VOID) S_PUTCHAR ('\t');
}
if (flags & V_FV_TICS)
{
(VOID) S_PRINTF ("value ");
if (flags & V_FV_LABEL_TICS)
(VOID) S_PRINTF ("labeled");
if (flags & V_FV_GRID)
(VOID) S_PRINTF ("gridded ");
}
(VOID) S_PUTCHAR ('\n');
}
/*======================================================================
|
| VUdbgColor
| Prints contents of COLOR_SPEC data structure.
*/
void
VUdbgColor (color)
COLOR_SPEC *color;
{
if (color->rgb_rep.rgb_rep_flag)
(VOID) S_PRINTF ("R:%d G:%d B:%d ",
(INT) color->rgb_rep.red,
(INT) color->rgb_rep.green,
(INT) color->rgb_rep.blue);
else
(VOID) S_PRINTF ("Index:%d ", (INT) color->color_index);
}
/*======================================================================
|
| VUdbgCtt
| Prints color threshold table contents.
*/
void
VUdbgCtt (size, ct)
int size;
COLOR_THRESHOLD *ct;
{
FAST INT i;
(VOID) S_PRINTF ("%d\t", size);
if (size)
for (i = 0; i < size; i++)
{
if (size > 1)
(VOID) S_PRINTF ("Threshold: %d ", (INT) ct[i].upperlimit);
(VOID) S_PRINTF ("Color ");
VUdbgColor ((COLOR_SPEC *) & ct[i].threshcolor.color_index);
(VOID) S_PUTCHAR ('\n');
}
else
VUdbgColor ((COLOR_SPEC *) ct);
}
/*======================================================================
|
| VUdbgVdp
| Prints out contents of a Variable Descriptor
*/
void
VUdbgVdp (vdp)
ADDRESS vdp;
{
INT arg1, arg2, arg3, vartype, accmode;
LONG irange1, irange2;
DOUBLE drange1, drange2;
CHAR *string, *vtype = "??";
COLOR_THRESHOLD *colorp;
DV_BOOL UseIrange;
if (!VIvdvalid (vdp, (CHAR *) NULL))
{
(VOID) S_PRINTF ("Not a variable descriptor.\n");
return;
}
(VOID) S_PRINTF ("variable descriptor: %lx", (LONG) vdp);
string = VGvdvarname (vdp);
if (string)
(VOID) S_PRINTF (" name: %s", string);
vartype = VGvdtype (vdp);
switch (vartype)
{
case V_C_TYPE:
UseIrange = YES;
vtype = "char";
break;
case V_UC_TYPE:
UseIrange = YES;
vtype = "unsigned char";
break;
case V_S_TYPE:
UseIrange = YES;
vtype = "short";
break;
case V_US_TYPE:
UseIrange = YES;
vtype = "unsigned short";
break;
case V_L_TYPE:
UseIrange = YES;
vtype = "long";
break;
case V_UL_TYPE:
UseIrange = YES;
vtype = "ULONG";
break;
case V_F_TYPE:
UseIrange = NO;
vtype = "float";
break;
case V_D_TYPE:
UseIrange = NO;
vtype = "double";
break;
case V_T_TYPE:
UseIrange = NO;
vtype = "text";
break;
default:
UseIrange = NO;
vtype = "??";
break;
}
(VOID) S_PRINTF ("\ttype: %s ", vtype);
(VOID) S_PRINTF ("at %lx\n ", (LONG) VGvdbase (vdp));
if (UseIrange)
{
VGvd_irange (vdp, &irange1, &irange2);
(VOID) S_PRINTF ("range: %d to %d ", (int)irange1, (int)irange2);
}
else if (vartype == V_F_TYPE || vartype == V_D_TYPE)
{
VGvd_drange (vdp, &drange1, &drange2);
(VOID) S_PRINTF ("range: %.7g to %.7g ", drange1, drange2);
}
VGvddim (vdp, &arg1, &arg2, &arg3);
(VOID) S_PRINTF ("size: %dx%dx%d", arg1, arg2, arg3);
accmode = VGvd_accmode (vdp);
if (accmode == V_DIR_ACCESS)
(VOID) S_PRINTF ("\tdirect access ");
else if (accmode == V_INDIR_ACCESS)
(VOID) S_PRINTF ("\tindirect access ");
else if (accmode == V_DS_BOUND)
(VOID) S_PRINTF ("\tdata source bound ");
else
(VOID) S_PRINTF ("\tunknown access mode ");
VGvdctt (vdp, &arg1, &colorp);
(VOID) S_PRINTF ("\n ");
VUdbgCtt (arg1, colorp);
string = VGvdvallabel (vdp);
if (string)
(VOID) S_PRINTF ("value label: %s\n", string);
}
/*======================================================================
|
| VUdbgDgp
| Prints out contents of DataGroup
*/
void
VUdbgDgp (dgp)
ADDRESS dgp;
{
FLOAT f1, f2, f3, f4;
CHAR *string;
RECTANGLE vp;
if (!VIdgvalid (dgp, "VUdbgDgp"))
{
(VOID) S_PRINTF ("Not a datagroup\n");
return;
}
(VOID) S_PRINTF ("\ndgp: %px ", dgp);
string = VGdgtitle (dgp);
if (string)
(VOID) S_PRINTF ("\n%px, Title: %s ", dgp, string);
(VOID) S_PRINTF ("%d variables\n", (INT) VGvdget (dgp, 0));
VGdgvp (dgp, &vp);
f1 = (float) vp.ll.x / 32767;
f2 = (float) vp.ll.y / 32767;
f3 = (float) vp.ur.x / 32767;
f4 = (float) vp.ur.y / 32767;
(VOID) S_PRINTF ("viewport: (%.2f,%.2f) (%.2f,%.2f)\n", f1, f2, f3, f4);
(VOID) S_PRINTF ("device: %d ", VGdgdevice (dgp));
(VOID) S_PRINTF ("%d slots ", VGdgslots (dgp));
/* Print the name of the graph */
string = MGdfname (VGdgdf (dgp));
if (string)
(VOID) S_PRINTF ("graph: %s", string);
(VOID) S_PUTCHAR ('\n');
VUdbgCcf (dgp);
string = VGdgaxlabel (dgp, 't');
if (string)
(VOID) S_PRINTF ("time label: %s\n", string);
string = VGdgaxlabel (dgp, '1');
if (string)
(VOID) S_PRINTF ("d1 label: %s\n", string);
string = VGdgaxlabel (dgp, '2');
if (string)
(VOID) S_PRINTF ("d2 label: %s\n", string);
VUvdtraverse (VGvdget (dgp, 1), VUdbgVdp);
}